package com.remind.integrate.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.remind.integrate.dao.UserDao;
import com.remind.integrate.entity.User;
import com.remind.integrate.service.UserService;

@Service
@Transactional
public class UserServiceImpl implements UserService{

	@Autowired
	private UserDao userDao;
	
	@Override
	public void save() {
		User user = new User();
		user.setName("test");
		user.setAge(19);
		userDao.save(user);
	}

	@Override
	@Transactional(rollbackFor={Exception.class})
	public void saveException() throws Exception {
		User user = new User();
		user.setName("testException");
		user.setAge(19);
		userDao.save(user);
		throw new Exception();
	}

}
